// Omit<T, K>:跟Pick反过来的，获取某一个接口类型T上没有K的属性, 跟Pick可以互相使用，相互取反就是对方了，用谁取决于K写的多不多

// 在理解Omit之前先回顾一下Exclude<T, K>的使用，【Exclude:T不满足泛型约束K的话则会返回T】
type Exclude<T, K> = T extends K ? never : T
interface People {
  name: string;
  age: number;
  phone: number
}

// 获取People上的namexport,age出来
type NameWithAge = Exclude<keyof People, 'phone'> // type NameWithAge = "name" | "age"
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> // Pick<People, "name" | "age">
type test = Omit<People, 'phone'>

// 可以使用Pick或者Omit
let test1: Pick<People, 'name' | 'age'> = {name: 'xiaoxiao', age: 9}
let test2: Omit<People, 'phone'> = {name: 'xiaoxiao', age: 9}

export {}